from frontend.roleApplication import RoleApplication
from frontend.form import Type

class CreditCardApplication(RoleApplication):
        def __init__(self):
            super(CreditCardApplication, self).__init__("CantonCandy", "Cashier")
            self.register_transition_step("ProcessCreditCard", self.take_credit_order_form_creator, name_fields=["sequence", "CandyType", "CandyQuantity"])
        '''
        Declare this application to be part of a given work flow and specify its role in that workflow.
        '''
        # Declare this application to be part of a given workflow, and responsible for a given role:
        # !!! Modify the following to use the actual work flow name and role name you need...
         
        # Declare any tasks that this role is able to perform:
        # !!! Modify to use actual name for this task...
         
        def take_credit_order_form_creator(self, stepname, form):
            form.add_static_label('Please enter your credit card information: ')
            form.add_field(Type.CHOICE, "CardType", labeltext="Card Type", choices=['Visa', 'Master Card', 'American Express'], initial='Visa');
            form.add_field(Type.SHORTSTRING, "Last 4 digits of card")
            form.add_field(Type.SHORTSTRING, "Expiration date (mm/yy)")
            form.add_field(Type.SHORTSTRING, "Name")
            
        '''
        This method does the actual work of building the user interface.
        '''
        # !!! improve this text...
        
        
                # !!! Add at least two fields here, along with any additional static labels you need...

if __name__ == '__main__':
    #starts up the OrderTakerApplication:
    app = CreditCardApplication()
    #Start interacting with the user:
    app.MainLoop()

